<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use yii\helpers\ArrayHelper;
use common\models\Offices;

/**
 * @var yii\web\View $this
 * @var common\models\Employees $model
 * @var yii\widgets\ActiveForm $form
 */
?>

<div class="employees-form">

    <?php $form = ActiveForm::begin([
        'options' => ['enctype' => 'multipart/form-data'],
    ]); ?>

    <?= $form->field($model, 'employeeNumber')->textInput(['disabled' => true]) ?>

    <?= $form->field($model, 'lastName')->textInput(['maxlength' => 50]) ?>

    <?= $form->field($model, 'firstName')->textInput(['maxlength' => 50]) ?>

    <?= $form->field($model, 'extension')->textInput(['maxlength' => 10]) ?>

    <?= $form->field($model, 'email')->textInput(['maxlength' => 100, 'disabled' => true]) ?>

    <?= $form->field($model, 'officeCode')->dropDownList(ArrayHelper::map(Offices::find()->asArray()->all(), 'officeCode', 'city')) ?>

    <?= $form->field($model, 'jobTitle')->textInput(['maxlength' => 50]) ?>

    <?= $form->field($model, 'reportsTo')->textInput() ?>

    <?= $form->field($model, 'avatar')->fileInput() ?>
    <?php if ($model['avatar'] !== null && $model['avatar'] !== '') { ?>
        <div class="form-group">
            <img class="img-rounded" src="<?php echo $model['avatar'] ?>" width="100px">
        </div>
    <?php } ?>

    <div class="form-group">
        <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
    </div>

    <?php ActiveForm::end(); ?>

</div>
